package work20241206_chap7.i;

/**
 * @author zdl
 * @date 2024/12/6
 */
class ClassA {
    static {
        System.out.println("In ClassA Static");
    }

    public ClassA() {
        System.out.println("ClassA()");
    }
}

class ClassB {
    static {
        System.out.println("In ClassB Static");
    }

    public ClassB() {
        System.out.println("ClassB()");
    }
}

class ClassC extends ClassB {
    static {
        System.out.println("In ClassC Static");
    }

    public ClassC() {
        System.out.println("ClassC()");
    }
}

class MyClass {
    static ClassA ca = new ClassA();
    ClassC cc = new ClassC();

    static {
        System.out.println("In MyClass Static");
    }

    public MyClass() {
        System.out.println("MyClass()");
    }
}

public class TestMain {
    public static void main(String args[]) {
        MyClass mc1 = new MyClass(); //In ClassA Static  ClassA()   In MyClass Static   In ClassB Static   In ClassC Static
        System.out.println();
        MyClass mc2 = new MyClass();
        System.out.println(mc1.cc == mc2.cc); //
        System.out.println(mc1.ca == mc2.ca);
    }
}